<template>
<el-form ref="list" :model="list" label-width="80px">
  <el-form-item label="账号" prop="userName">
    <el-input v-model="list.userName"></el-input>
  </el-form-item>
  <el-form-item label="昵称" prop="nickName">
    <el-input v-model="list.nickName"></el-input>
  </el-form-item>
  <el-form-item label="密码" prop="password">
    <el-input type="password" v-model="list.password"></el-input>
  </el-form-item>


  <el-form-item>
    <el-button type="primary" @click="onSubmit">添加</el-button>
    <el-button>重置</el-button>
  </el-form-item>
</el-form>
</template>
<script>
import {yhAdd} from '../../api/yonghu'
export default {
  data(){
    return{
      list:{
        userName:"",
        nickName:"",
        password:""
      }
    }
  },
  methods:{
    onSubmit(){
      yhAdd(this.list)
      this.$router.push({name:"yh"})
    }
  }
}
</script>
